#include "CT_Edge_Info.h"
#include "Log.h"

CT_Edge_Info::CT_Edge_Info(double len) {
    LOG_ENTER(GRAPH, "CT_Edge_Info::CT_Edge_Info");

    length = len;

    LOG_EXIT();
}

std::ostream& CT_Edge_Info::print(std::ostream& os) const {
    os << "[ " << length << " ]";
    return os;
}

bool CT_Edge_Info::match(Parser& parser) {
    LOG_ENTER(INPUT, "CT_Edge_Info::match");

    int m = 0;
    m += parser.match_char  ("[");
    m += parser.match_double(length);
    m += parser.match_char  ("]");

    if (m == 3) {

        LOG_EXIT();

        return true;
    }

    parser.backup(m);

    LOG_EXIT();

    return false;
}

std::ostream& operator<<( std::ostream& os,
                          const CT_Edge_Info& e ) {
    return e.print(os);
}
